home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
menuge.zip
/
MENUGEN.DOC
< prev
next >
Wrap
Text File
|
1990-12-19
|
6KB
|
151 lines
MenuGen Version 1.0
Menu and Status Line Generator for
Borland's Turbo Pascal 6.0(R) with
TurboVision(R)
(C) Copyright 1990 by Vernon J. Adams
All Rights Reserved
Further copyright information given below
INTRODUCTION
The enclosed program is a simple compiler designed to ease the
coding of menu entries and status line entries. I found that when
I looked at the TurboVision Manual the routines to build a menu and
a status line were daunting at best (All those nested
parentheses!!). So, rather than count nesting levels, I wrote a
simple compiler to take a keyword driven specification of the menu
and status entries and then generate the Pascal code to build the
menus. That's what the enclosed program does. It accepts a
specification language and creates Pascal code.
The language to specify the menu and status lines is simple. It
consists of keywords followed by the arguments to the procedures
calls you would make in Pascal.
REQUIREMENTS
Borland's Turbo Pascal(R) version 6.0
Some familiarity with the Turbo Vision package
The following files are supplied:
MENUGEN.EXE The Menu-Status Line Generator program
TESTMENU.MDF The Sample Menu-Status Line Specification
TESTMENU.PAS The output of a generation of the sample
MENUGEN.DOC This file
TO GENERATE MENU-STATUS LINE CODE
MENUGEN input-file output-file
input-file is the Menu-Status Line Specification
output-file is the pascal generated from the
specification
A sample specification follows:
APPLICATION TMApp
MENU MyMenu
SUBMENU ~F~ile
ITEM ~O~pen F3 kbF3 cmFileOpen
ITEM ~N~ew F4 kbF4 cmNewWin
SEPARATOR
ITEM E~x~it Alt-X kbAltX cmQuit
SUBMENU ~W~indow
ITEM ~N~ext F6 kbF6 cmNext
ITEM ~Z~oom F5 kbF5 cmZoom
ITEM ~D~ialog F2 kbF2 cmNewDialog
STATUS StatLine
KEY "~Alt-X~ Exit" kbAltX cmQuit
KEY "~F4~ New" kbF4 cmNewWin
KEY "~Alt-F3~ Close" kbAlt3 cmClose
Let's look at the sample to get a feel for the specification
language. First, all whitespace is equal; the indentations are for
reading clarity only. Second, all the keywords are capitalized for
the same reason, kewords do not need to be capitalized. An
argument only needs to be quoted if it contains whitespace. The
names after the MENU and STATUS keywords are optional since the
Application object contains variables to hold these items. The
name after the APPLICATION keyword is the name of the Application
object type.
This example along with the discussions in the TurboVision(R)
Manual should give you a good idea of how the program works. It
just a straight forward generation of the code to relieve the
program from the tedium of counting parentheses.
Now for a formal definition of the specification language.
MenuStatusSpec := ApplicationHeader MenuSpec StatusSpec
ApplicationHeader := APPLICATION [ApplicationName]
MenuSpec := MenuHeader SubMenuSpec*
MenuHeader := MENU [MenuName]
SubMenuSpec := SubMenuHeader ItemSeparatorSpec*
SubMenuHeader := SUBMENU SubMenuText
ItemSepartorSpec := ItemSpec | SeparatorSpec
SeparatorSpec := SEPARATOR
ItemSpec := ITEM ItemLabel HotKeyLabel HotKey Command
StatusSpec := StatusHeader KeySpec
StatusHeader := STATUS [StatusBarName]
KeySpec := KEY KeyLabel HotKey Command
Keywords can be upper or lower case. Specifications can be split
across lines.
Please note: This generator is not particularly robust in handling
errors. It was designed as a quick convenience for bypassing
tedious coding. If a specification does not compile or the
generator objects, compare that specification with the example and
grammar above and compare it with the examples in the
TurboVision(R) Manual.
Combined with L. David Baldwin's DLGDSN(C), this program should make
creating TurboVision(R) programs much simpler.
COPYRIGHT
Documentation and Program (C) Copyright 1990 by Vernon J. Adams.
All Rights Reserved.
Other brand and product names are trademarks or registered
trademarks of their respective holders.
MENUGEN may be copied and distributed freely by individuals to
friends and acquaintances providing that no fee is charged with
the exception of a reasonable handling and distribution fee and it
is not part of a package for which a charge is made. The output
from MENUGEN may be used freely for any legal purpose.
Also please report any problems, suggestions, etc.
You may contact me by Compuserve or at the addresses below.
Vernon J. Adams
CompuServe ID #71201,63.
5927 Western Hills Dr.
Norcross, GA 30071